#ifndef ORGANIZEDTEXTCONTEXT_H
#define ORGANIZEDTEXTCONTEXT_H

#include "textcontext.h"
#include <vector>

/****************************************************
  Orgnazied text context. This class supports formated
  text.
 ****************************************************/
class OrganizedTextContext : public TextContext
{
public:
    OrganizedTextContext();
    ~OrganizedTextContext();

    // Set the chars per line and lines per page params
    void setFormat(int charsPerLine, int linesPerPage){
        _charsPerLine = charsPerLine;
        _linesPerPage = linesPerPage;
        build();
    }

    // Get characters per line
    int getCharsPerLine(){
        return _charsPerLine;
    }

    // Get lines per page
    int getLinesPerPage(){
        return _linesPerPage;
    }

    void build();

    // Get end of lines
    std::vector<int> * getLines(){
        return &_lines;
    }

    // Get end of pages
    std::vector<int> * getPages(){
        return &_pages;
    }

    // Get end of paragraphs
    std::vector<int> * getParagraphs(){
        return &_paragraphs;
    }

private:
    std::vector<int> _lines;
    std::vector<int> _pages;
    std::vector<int> _paragraphs;
    int _charsPerLine;
    int _linesPerPage;

    void onEndOfLine(int, int&, int&, int&);
};

#endif // ORGANIZEDTEXTCONTEXT_H
